<template>
    <div class="zong">
        <div class="top">
            <div><img class="topleftimg" :src="songlistdata.coverImgUrl" alt=""></div>
            <div class="topright">
                <div class="name">
                    <div class="namename">歌单</div>
                    <div>{{ songlistdata.name}}</div>
                </div>
                <div class="user" v-if="songlistdata.creator">
                    <img  :src="songlistdata.creator.avatarUrl" alt="">
                    <div class="username">{{songlistdata.creator.nickname}}</div>
                    <div>{{songlistdatatime(songlistdata.createTime) }} 创建</div>
                </div>
                <div class="plays">
                    <div class="play" @click="bofangquanbu"><i class="el-icon-caret-right"></i>播放全部</div>
                    <div class="playss subscribedCount"><i class="el-icon-folder-add"></i>收藏({{numbers(songlistdata.subscribedCount)}})</div>
                    <div class="playss trackCount"><i class="el-icon-link"></i>分享({{numbers(songlistdata.trackCount)}})</div>
                    <div class="playss dw"><i class="el-icon-download"></i>下载全部</div>

                </div>
                <div class="tags">
                    <div class="tag tagtop">
                        标签：<div>
                        <span v-for='item in songlistdata.tags' :key='item'>{{item}}</span>
                        </div>
                    </div>
                    <div class="tag tagsplay">
                        歌曲：<div>{{songlistdata.trackCount}}</div>播放：<div>{{numbers(songlistdata.playCount)}}</div>
                    </div>
                    <div class="tag description">
                        简介：<div>{{songlistdata.description}}</div>
                    </div>

                </div>

            </div>
        </div>


        <div class="bottom">
            <ul >
                <router-link  :to="{ name: 'songlistname', params: { id: songlistid }}" custom v-slot="{navigate,isActive}">
                <li @click="navigate" >
                    <span :class="isActive?'flims':''">歌曲列表</span>
                </li>
                </router-link>
                <router-link :to="{ name: 'commentname', params: { id: songlistid }}" custom v-slot="{navigate,isActive}">
                <li @click="navigate" >
                    <span :class="isActive?'flims':''">评论</span>
                </li>
                </router-link>
                <router-link :to="{ name: 'collectionname', params: { id: songlistid }}" custom v-slot="{navigate,isActive}">
                <li @click="navigate" >
                    <span :class="isActive?'flims':''">收藏者</span>
                </li>
                </router-link>
            </ul>
            <router-view></router-view>
        </div>
    </div>
</template>

<script>
import http from '@/http/http.js'
import moment from 'moment'
import million from '@/unit/numberhalden.js'  //数字过万处理


export default {
    data() {
        return {
            songlistid:null,
            songlistdata:{}
        }
    },
    created() {
        console.log(this.$route.params.id)
        this.songlistid = this.$route.params.id
        http({
            url:'/playlist/detail',
            params:{
                id:this.songlistid
            }
        }).then(res =>{
            this.songlistdata = res.data.playlist
            console.log(this.songlistdata)

        })
    },
    mounted() {
        
        
    },
    methods: {

        bofangquanbu(){
           
        
                http({
                url:'/song/url',
                params:{
                    id:this.$store.state.songlist[0].id
                },
                
            }).then(res=>{
                // console.log(res.data.data[0])
                this.$store.commit('musicurlhandle',res.data.data[0].url)
                this.$store.commit('isplaybofang')

                
            })
            var songss = this.$store.state.songlist[0]
            this.$store.commit('musicuserhandle',songss)

            //把当前页面的歌单存入当前播放歌单
            this.$store.commit('songnew')
                // this.$store.commit('index')

            
           

        },
        //数字过万处理
        numbers(value){
            return million(value)
        },

        //时间格式化
        songlistdatatime(time){
            return moment(time).format('YYYY-MM-DD')
        }
        //
        
        
    },
    // beforeDestroy() {
    //     this.$store.commit('qingkong')
    // },
}
</script>

<style lang="less" scoped>
.zong{
    overflow: hidden;
    height: 800px;
    overflow-y: scroll;
}

::-webkit-scrollbar
{
	width: 9px;
	height: 16px;
	background-color: #F5F5F5;
}

::-webkit-scrollbar-track
{
	// -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
	border-radius: 10px;
	background-color: #F5F5F5;
}
 
/*定义滑块 内阴影+圆角*/
::-webkit-scrollbar-thumb
{
	border-radius: 10px;
	// -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
	background-color: pink;
}

ul{
        
        display: flex;
        width: 30%;
        height: 3.0625rem;
        line-height: 3.0625rem;
        min-width:200px;
        width: 200px;
        margin-left: 10px;

        // border-bottom:1px solid rgba(200,200,200,0.25);
        z-index: 100;
        li{
            list-style: none;
            flex: 1;
            text-align: center;
        }
        span{
            cursor: pointer;
            padding-bottom: .80rem;
            -webkit-user-select:none;  //文字不可选择
            -moz-user-select:none;
            -ms-user-select:none;
            user-select:none;
        }
    }
    .flims{
       color:pink;
       border-bottom: 2px solid pink;
} 



.top{
    display: flex;
    flex-direction: row;
    // height: 18.75rem;
    padding: 1.125rem;
    min-width: 1200px;
    .topleftimg{
        width:200px;
        height: 200px;
        margin-right: 20px;
        border-radius: 10px;
    }
    .name{
        display: flex;
        flex-direction: row;
        height: 50px;

        .namename{
            display: line;
            color: pink;
            padding: 2px;
            font-size: 14px;
            border: pink 1px solid;
            border-radius: 5px;
            margin-top: 5px;
            height: 20px;
        }
        div{
            height: 40px;
            margin-left: 5px;
            font-size: 25px;
            font-weight: bold;
            
        }
    }
    .user{
        display: flex;
        flex-direction: row;
        align-items: center;
        img{
            width: 30px;
            height: 30px;
            border-radius: 30px;
        }
        .username{
            color: #507daf;
        }
        div{
            margin-left: 5px;
            font-size: 12px;
        }
    }
.plays{
    display: flex;
    flex-direction: row;
    margin: 10px 0;
    .play{
        height: 30px;
        width: 110px;
        background-color: #ff7a9e;
        color: white;
        border-radius: 30px;
        text-align: center;
        line-height: 30px;
        font-size: 13px;
        cursor: pointer;
        padding-right: 3px;
        i{
            font-size: 15px;
            margin-right: 3px;
        }
    }
    .play:hover{
        background-color: #de688a;
    }
    .playss{
        height: 30px;
        width: 110px;
        line-height: 30px;
        font-size: 13px;
        color: #373737;
        border: 1px solid #d8d8d8;
        text-align: center;
        cursor: pointer;
        border-radius: 30px;
        padding-right: 3px;
        i{
            font-size: 15px;
            margin-right: 3px;
        }

    }
    .playss:hover{
        background-color: #f2f2f2;
    }
    div{
        margin-right: 10px;
    }
}
.tags{
    margin-top: 10px;
    line-height: 23px;
    .tag{
        display: flex;
        flex-direction: row;
        color: #373737;
        font-size: 13px;
        span{
            margin-right: 5px;
        }
        div{
            color: #999;
            margin-right: 3px;
        }
    }
}
.tagsplay{
    div{
        margin-right: 5px;
    }
}

.description{
    div{
        width: 900px;
        overflow: hidden;  //溢出隐藏
        text-overflow: ellipsis;
        white-space: nowrap;
    };
    
}
    // img{
    //     width: 50px;
    //     height: 50px;
    // }
}
</style>